<template>
  <div>
    <el-row class="main"  :gutter="5" style="display:flex;align-items:center">
      <el-col :xs={span:24}  :sm={span:18,offset:3} :md={span:16,offset:4}  :xl={span:14,offset:5} class="top">
        <div style="z-index:10"> 
          
          <el-row    :gutter="5" align="middle">
               <el-col :xs={span:23,offset:1}  :sm={span:6} :md={span:6}  :xl={span:6} class="top">
          <h2 >
            <strong style="margin-left:0px;display:block">{{data.title}}</strong>
          </h2>
               </el-col>
          <!-- 描述：文章信息 -->
           <el-col :xs={span:24}  :sm={span:18} :md={span:18}  :xl={span:18} class="top">
          <div class="text-center timeAndView" >
            <span class="article-time">
              <i class="el-icon-time"></i>
              发表于：
              <span>{{data.createtime}}</span>
            </span>
            &nbsp;|&nbsp;
            <span class="article-views">
              <i class="el-icon-view"></i>
              阅读量：
              <strong>{{data.number}}</strong>
            </span>
          </div>
           </el-col>
          </el-row>


          <p class="abstract" >{{data.content}}</p>

        <hr />

        <div id="artcle-content">
    
        </div>
 <el-row class="main"  justify="center" > 
   <el-col :xs={span:24}  :sm={span:24} :md={span:24}  :xl={span:24}>
       <img  id="artcle-info"  :src = "data.imgcode"/>
    <div v-html="data.html" id="show"></div>
</el-col>
 </el-row>      

        

          <p>&nbsp;</p>

          <p>
            <span style="color:#3399ea;">
              <em>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 向上的路并不拥挤，到多数人选择了安逸！--{{data.author}}</em>
            </span>
          </p>
        </div>

        <div id="statement">
          <div class="item">{{$t('article.author')}}：{{data.author}}</div>
          <div class="item">
            {{$t('article.originalLink')}}：
            <a href="http://www.myblog-tao.cn/">http://www.myblog-tao.cn/</a>
          </div>
          <div class="item">{{$t('article.copyright')}}：本博客所有文章除特别声明外,转载请注明出处!</div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "article",
  data(){
    return {
      data:{}
    }
  },
  methods:{
    
    // 获取详细数据
    getData(id){

           this.$http.get("/api/blog/detail",{params: { id:id}}).then((res)=>{
      
          this.data = res.data.data;

          console.log(JSON.stringify(res.data));

    })

    }

  },
  created() {

    let id = this.$route.params.id
     
     this.getData(id)

  },
  watch:{
     $route(to,from){
     let id = this.$route.params.id
    
     if(id){
        this.getData(id)
     }
    
  }

  }

};
</script>

<style scoped>
.top{
  position: relative;
}
#artcle-info {
  background-repeat: no-repeat;
  background-position: center center;
  background-size:cover;
  width: 100%;
  height:100%;
  border-radius: 10%;
}

 .abstract {
  color: #333333;
  border-left: 3px solid #f56c6c;
  padding: 10px;
  background-color: rgba(126, 129, 135, 0.3);
}

 .timeAndView {
  padding: 20px;
  line-height: 30px;
  font-size: 16px;
  color: #333333;
}

pre.has {
  color: #333333;
  background-color: rgba(0, 0, 0, 0.8);
}

img.has {
  width: 100%;
}

#statement {
  border-left: 3px solid #f56c6c;
  padding: 20px;
  background-color: #ebeef5;
}
#show{
   width: 100%;
}

#show >>> img{
   max-width: 100%;
   max-height:100%;
} 

.centers{
  text-align: center;
}


</style>